// 其他模块信息
const modules = import.meta.globEager("./modules/**/*.js");

// export const LoginRoute = {
//   path: "/login",
//   name: "Login",
//   component: () => import("@/layout/pages/system/Login/index.vue"),
//   meta: {
//     title: "用户登陆"
//   }
// };

// 404 on a page
export const PageNotFound = {
  path: "/:path(.*)*",
  name: "PAGE_NOT_FOUND_NAME",
  component: () => import("@/layout/default/index.vue"),
  meta: {
    title: "ErrorPage",
  },
  children: [
    {
      path: "/:path(.*)*",
      name: "PAGE_NOT_FOUND_NAME",
      component: () => import("@/layout/pages/404/index.vue"),
      meta: {
        title: "ErrorPage",
      },
    },
  ],
};

const RouteModuleList = [];

Object.keys(modules).forEach(key => {
  const mod = modules[key].default || {};
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  RouteModuleList.push(...modList);
});

export const MainRoute = {
  path: "/",
  name: "root",
  redirect: "/dashboard",
};

export const basicRoutes = [...RouteModuleList, MainRoute, PageNotFound];
